package com.common.www.repository.tabulation;

import org.springframework.boot.base.jpa.repository.support.ExtendedRepository;
import com.common.www.bean.entity.tabulation.OuterTabulation;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface OuterTabulationRepository extends ExtendedRepository<OuterTabulation, Long> {

    /**
     * 按biddingCompanyId查询
     * @param flag
     * @param biddingCompanyId
     * @return
     */
    List<OuterTabulation> findByFlagAndBiddingCompanyId(Integer flag, Long biddingCompanyId);

    /**
     * 按biddingCompanyId、jieDuan查询
     * @param flag
     * @param projectId
     * @param jieDuan
     * @return
     */
    List<OuterTabulation> findByFlagAndBiddingCompanyIdAndJieDuan(Integer flag,Long projectId,Integer jieDuan);

    /**
     * 按项目删除
     * @param biddingCompanyId
     * @param jieDuan
     * @return
     */
    @Modifying
    @Transactional
    int deleteByBiddingCompanyIdAndJieDuan(Long biddingCompanyId,Integer jieDuan);
}
